/*
 * Copyright (c) 2018. J4dream created
 */

package com.j4dream.property.javabasic.designpattern.singleton;

// 双重校验锁 + volatile
public class Singleton3 {
    private volatile static Singleton3 ins;

    private Singleton3() {}

    public static Singleton3 getIns() {
        if (ins == null) {
            synchronized (Singleton3.class) {
                if (ins == null) {
                    ins = new Singleton3();
                }
            }
        }
        return ins;
    }
}

